//
//  MacroHeader.h
//  breadPro
//
//  Created by 刘文超 on 2019/7/5.
//  Copyright © 2019 刘文超. All rights reserved.
//

#ifndef MacroHeader_h
#define MacroHeader_h
#define LS_LAZY(object,assignment) (object = object ? : assignment)
#define LS_Getimage(a)  [UIImage imageNamed:a]
//字符串初始化
#define kFORMAT(f, ...)      [NSString stringWithFormat:f, ## __VA_ARGS__]

#define LS_SetColor(r,g,b) [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:1.0f]
#define LS_SetAColor(r,g,b,a) [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:a]
#define  LS_lightColor   LS_SetColor(65, 170, 184)
#define  MainColor      LS_SetColor(80, 189, 203)

#define ScreenWidth  [[UIScreen mainScreen] bounds].size.width
#define ScreenHeight [[UIScreen mainScreen] bounds].size.height

//适配
//判断设备
#define IS_IPHONE_5 ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )568 ) < DBL_EPSILON )
#define IS_IPHONE_6 ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )667 ) < DBL_EPSILON )
#define IS_IPHONE_6P ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )736 ) < DBL_EPSILON )
#define IS_IPhoneXSeries (([[UIApplication sharedApplication] statusBarFrame].size.height == 44.0f) ? (YES):(NO))
#define ls_proW  [UIScreen mainScreen].bounds.size.width/320.0
#define ls_proH  [UIScreen mainScreen].bounds.size.height/568.0

//-------------------打印日志-------------------------
//DEBUG  模式下打印日志,当前行
#ifdef DEBUG
#define LS_Log(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
#define LS_Log(...)
#endif

//字体适配 内联函数
static inline CGFloat LS_Fonsize(CGFloat fontSize){
    if (ScreenWidth == 320) {
        return fontSize-1;
    }else if (ScreenWidth == 375){
        return fontSize;
    }else if (ScreenWidth == 414){
        return fontSize+1;
    }else{
         return fontSize+2;
    }
}

#define LS_Font(a) [UIFont systemFontOfSize:LS_Fonsize(a)]
#define LS_FontWithname(a,b) [UIFont fontWithName:a size:b]
#endif /* MacroHeader_h */
